<template>
  <div>
    <ul class="mui-table-view">
      <li
        class="mui-table-view-cell mui-media"
        v-for="(idx, item) in news"
        :key="item"
      >
        <router-link :to="'/home/newslist/newdetail/' + idx.id">
          <img class="mui-media-object mui-pull-left" :src="idx.img_url" />
          <div class="mui-media-body">
            <h1>{{ idx.title }}</h1>
            <p class="mui-ellipsis">
              <span
                >发表时间{{
                  idx.add_time | dateformat("YYYY-MM-DD HH:mm:ss")
                }}</span
              >
              <span>点击{{ idx.click }}</span>
            </p>
          </div>
        </router-link>
      </li>
    </ul>
  </div>
</template>
<script>
import { newslist } from "../../../static/api";

export default {
  data() {
    return {
      news: [],
    };
  },
  async created() {
    this.news = await newslist();
    console.log(this.news);
  },
  methods: {},
};
</script>
<style lang="scss" scoped>
.mui-table-view {
  li {
    h1 {
      text-align: left;
      font-size: 14px;
    }
    .mui-ellipsis {
      font-size: 12px;
      color: #226aff;
      display: flex;
      justify-content: space-between;
    }
  }
}
</style>
